package com.ldy.seal.common;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ldy.seal.web.Result;

/**
 * 通用异常处理
 * @author lindeyi
 *
 */
@ControllerAdvice
public class GlobalExceptionHandler {
	private static final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);

	@ResponseBody
	@ExceptionHandler
	public Result globalException(Exception e) {
		logger.info("GlobalExceptionHandler: {}", e.getMessage());
		return Result.failure(e.getMessage());
	}

}
